fix(parser): resolve custom-language names via configurable name_field (#691) - #702
fix(parser): resolve custom-language names via configurable name_field (#691)#702anusbutt wants to merge 1 commit into
Conversation
tirth8205#691) The generic walker only found a definition's name from an identifier-like child or a field literally named "name", so BibTeX/LaTeX/Markdown nodes whose name lives in a differently named or nested field were extracted unnamed and silently dropped. Add an optional `name_field` (string or ordered list) to languages.toml. For custom languages only, resolve each candidate field-first across all candidates, then by descendant node type, then descend to a clean text leaf. Built-in language extraction is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The 31 focused tests pass, but the configured name_field is not authoritative as described. _get_name accepts a generic direct-child identifier before it consults the configured field, so an unrelated identifier can still win. Please resolve the configured name_field first (or document different precedence) and add a fixture containing both an unrelated direct identifier and the configured field. |
Integrates contributor PR #702 with its author commit preserved, resolves the current-main conflict, and adds a RED-to-GREEN precedence regression. Validation: 579 affected tests, Ruff, diff checks, and a clean 242-file full graph build.
|
Integrated through #736, merged as 805c4c6. Your contributor-authored commit is preserved in the merge history. The integration resolves the current-main parser conflict, makes configured name_field precedence authoritative, and adds the missing end-to-end competing-identifier regression. Final validation: 579 affected tests passed, Ruff/diff checks passed, and a full 242-file graph build completed cleanly. Closing this original PR as incorporated. |
Linked issue
Closes #691
What & why
The generic walker's name heuristic only checked an identifier-like child or a
field literally named
name, so common BibTeX/LaTeX/Markdown node shapes wereextracted unnamed and silently dropped (losing the node and all its edges).
Adds an optional
name_fieldkey to.code-review-graph/languages.toml(string or ordered list). For custom languages only, each candidate is resolved
field-first across all candidates, then by descendant node type, then descended
to a cleaned text leaf. Two-pass ordering makes precise fields win over a
broader type match (e.g. LaTeX
\newcommandresolves viadeclaration, not thetextnode in its body). Anchoring on configured candidates avoids returningunrelated inner identifiers (e.g. BibTeX field labels
title/author).Built-in language extraction is byte-for-byte unchanged.
How it was tested